<?php
Util::tsRegisterAssetJs('_form.js');
/** @var CuentaController $this */
/** @var Cuenta $model */
/** @var AweActiveForm $form */
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'id' => 'cuenta-form',
    'type' => 'horizontal',
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
    'enableClientValidation' => true,
        ));
?>

<div class="span8">
    <div class="widget orange">
        <div class="widget-title">
            <h4><i class="icon-briefcase"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . Cuenta::label(); ?></h4>
            <span class="tools">
                <a href="javascript:;" class="icon-chevron-down"></a>
                <!--a href="javascript:;" class="icon-remove"></a-->
            </span>
        </div>
        <div class="widget-body">

            <p class="note"><?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span> <?php echo Yii::t('AweCrud.app', 'are required') ?>.</p>

            <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 64, 'class' => 'span10')) ?>
            <?php echo $form->textFieldRow($model, 'razon_social', array('maxlength' => 64, 'class' => 'span10')) ?>
            <?php echo $form->textFieldRow($model, 'documento', array('maxlength' => 20, 'data-mask' => '00000000000000', 'class' => 'span6')) ?>

            <?php echo $form->textFieldRow($model, 'telefono', array('maxlength' => 24, 'data-mask' => '000-000000', 'class' => 'span6')) ?>
            <?php echo $form->dropDownListRow($model, 'industria_id', CHtml::listData(Industria::model()->orden()->findAll(), 'id', Industria::representingColumn()), array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
            <?php echo $form->textFieldRow($model, 'fax', array('maxlength' => 24, 'data-mask' => '000-000000', 'class' => 'span6')) ?>
            <?php echo $form->textFieldRow($model, 'empleados', array('class' => 'span4', 'data-mask' => '000000000')) ?>
            <?php echo $form->textFieldRow($model, 'ingresos_anuales', array('class' => 'span4 money')) ?>
            <?php echo $form->dropDownListRow($model, 'tipo', $model->tipoOpciones, array('empty' => '- Seleccione -', 'class' => 'span6 fix')) ?>
            <?php echo $form->textFieldRow($model, 'website', array('maxlength' => 255, 'class' => 'span6')) ?>



            <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'class' => 'span10')) ?>

            <div class="form-actions">
                <div class="form-actions-float">
                    <?php
                    $this->widget('bootstrap.widgets.TbButton', array(
                        'buttonType' => 'submit',
                        'type' => 'success',
                        'icon' => 'ok',
                        'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                    ));
                    ?>
                    <?php
                    $this->widget('bootstrap.widgets.TbButton', array(
                        'icon' => 'remove',
                        'label' => Yii::t('AweCrud.app', 'Cancel'),
                        'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                    ));
                    ?>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="span4">
    <?php if ($grupos): ?>
        <div class="widget green">
            <div class="widget-title">
                <h4><i class="icon-archive"></i> Grupos</h4>
                <span class="tools">
                    <a href="javascript:;" class="icon-chevron-down"></a>
                    <!--a href="javascript:;" class="icon-remove"></a-->
                </span>
            </div>
            <div class="widget-body">
                <div class="check-box-list">
                    <?php echo $form->checkBoxList($model, 'grupos', CHtml::listData($grupos, 'id', 'nombre'), array_map('AweHtml::getPrimaryKey', $model->grupos)); ?>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <div class="widget">
        <div class="widget-title">
            <h4><i class="icon-lock"></i> Permisos</h4>
            <span class="tools">
                <a href="javascript:;" class="icon-chevron-down"></a>
                <!--a href="javascript:;" class="icon-remove"></a-->
            </span>
        </div>
        <div class="widget-body permisos">
            <?php echo $form->dropDownListRow($model, 'owner_id', CHtml::listData(Yii::app()->user->um->listUsers(), 'iduser', 'username'), array('empty' => '- Seleccione -', 'class' => 'span12 fix')) ?>
            <div class="radio-list">
                <?php echo $form->radioButtonListRow($model, 'permisos', $model->permisosOpciones) ?>
            </div>
        </div>
    </div>
</div>

<?php $this->endWidget(); ?>